<?php 

Yii::import('application.models._base.BaseEarnedBidLog');

class UserPurchaseHistory extends BaseEarnedBidLog{
	
	public static function model($className=__CLASS__) {
		return parent::model($className);
	}
	
	public function search(){
		$criteria = new CDbCriteria;
		$criteria->compare('id', $this->id);
		$criteria->compare('customer_id', $this->customer_id, true);
		$criteria->compare('amount', $this->amount);
		$criteria->compare('value', $this->value, true);
		$criteria->compare('bid_source_type', $this->bid_source_type);
		$criteria->compare('bid_type', $this->bid_type);
		$criteria->compare('created', $this->created);
		$criteria->compare('note', $this->note, true);
		$criteria->compare('bid_pack_id', '>0');
		$criteria->compare('payment_method', '>0');
		$criteria->compare('parent_id', $this->parent_id);
		$criteria->compare('bid_num', $this->bid_num);
		return new CActiveDataProvider($this, array(
			'criteria' => $criteria,
			'pagination' => array(
				'pageSize' => 6,
			),
			'sort' => array(
					'defaultOrder' => 't.created desc',
			),
		));
	}
	
}
